import http from '@/http/http'
import {
    LoginParam,
    LoginResult,
    SysUserInfoParam,
    SysUserLoginParam,
    VisitorInfo
} from './UserModel'

enum Api {
    userLogin = '/visitor/login',
    getVisitorInfo = '/visitor/info',
    upload = '/message/upload',
    setMsgRead = '/message/set_msg_read'
}

// 登录
export async function loginApi(params: LoginParam) {
    return await http.post<LoginResult>(Api.userLogin, params)
}
// 获取访客信息
export const getVisitorInfoApi = async () => {
    return await http.get<VisitorInfo>(Api.getVisitorInfo)
}

// 上传文件
export async function getUploadApi(params: FormData) {
    return await http.postFile(Api.upload, params)
}

// 设置消息为已读
export const setMsgReadApi = async () => {
    return await http.get(Api.setMsgRead)
}
